<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>伪类选择器</title>
		<style type="text/css">
			a{
				text-decoration: none;
				color: #000;
			}
			/*第六个li*/
			ul li:nth-of-type(6){
				background: #FFC0CB;
			}
			/*第六个li的第4个span*/
			ul li:nth-of-type(6) span:nth-of-type(4){
				font-size: 28px;
				background: #87CEFA;
			}
			/*第一个li*/
			ul li:first-of-type{
				text-decoration: overline;
			}
			/*最后一个li*/
			ul li:last-of-type{
				color: #90EE90;
			}
			/*倒数第8个li*/
			ul li:nth-last-of-type(8){
				border: 2px dashed #F08080;
			}
			
			/*第六个li里面的第3个元素,并且标签名为span*/
			li:nth-of-type(6) span:nth-child(3){
				border-bottom: 3px solid #87CEFA;
			}
			/*第6个li里面的最后一个子元素,并且标签名为span*/
			li:nth-of-type(6) span:last-child{
				border-bottom: 3px solid #87CEFA;
			}
			/*第6个li里面的第一个子元素,并且标签名为span*/
			li:nth-of-type(6) span:first-child{
				text-decoration: line-through;
			}
		</style>
	</head>
	<body>
		<!--
			要选中第几个元素时,之前的写法是设置class或id
			现在的写法:
				6为要选中的第几个元素,此处为第六个
				元素:nth-of-type(6){
					
				}
				可以结合其他选择器
		-->
		<ul>
			<li>1</li>
			<li>2</li>
			<li>3</li>
			<li>4</li>
			<li>5</li>
			<li>6
				<span>span1</span>
				<a href="#">这是a标签</a>
				<span>span2</span>
				<span>span3</span>
				<span>span4</span>
				<span>span5</span>
				<span>span6</span>
			</li>
			<li>7</li>
			<li>8
				<span class="span1">span1</span>
				<span>span2</span>
				<span class="span1">span3</span>
				<span>span4</span>
				<span class="span1">span5</span>
				<span>span6</span>
			</li>
			<li>9</li>
		</ul>
	</body>
</html>
